def hannuo(n,a,b,c):
    if n==1:
        print a,'->',c
    else:
        hannuo(n-1,a,c,b)
        print a,'->',c
        hannuo(n-1,b,a,c)
    return
hannuo(3,'a','b','c')
